package org.example.text03;

/**
 * 战士类，继承年龄姓名抽象类
 */

public class Soldier extends NameRole{
    //攻击力属性
    private int hurt;
    //武器属性
    private Weapon weapon;
    @Override
    public int attack() {
        return hurt + weapon.fire();
    }

    @Override
    public void practise() {
        hurt += 10;
    }

    public Soldier() {
    }

    public Soldier(String name, int age, int hurt, Weapon weapon) {
        super(name, age);
        this.hurt = hurt;
        this.weapon = weapon;
    }

    public int getHurt() {
        return hurt;
    }

    public void setHurt(int hurt) {
        this.hurt = hurt;
    }

    public Weapon getWeapon(Bolo bolo) {
        return weapon;
    }

    public void setWeapon(Weapon weapon) {
        this.weapon = weapon;
    }
}
